package edu.whpu.sztz.action.login;

import javax.servlet.http.Cookie;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public String login() throws Exception {
		Cookie usernameCookie = new Cookie("username", "root");
		usernameCookie.setMaxAge(3600 * 24 * 30);
		Cookie passwordCookie = new Cookie("password", "root");
		passwordCookie.setMaxAge(3600 * 24 * 30);
		
		ServletActionContext.getResponse().addCookie(usernameCookie);
		ServletActionContext.getResponse().addCookie(passwordCookie);
		return SUCCESS;
	}
}
